package com.hao.tool.web.module.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hao.tool.common.enums.ShortEnum;
import com.hao.tool.web.module.base.entity.ShortInfo;
import com.hao.tool.web.module.base.mapper.ShortInfoMapper;
import com.hao.tool.web.module.base.service.ShortInfoService;
import org.springframework.stereotype.Service;

/**
 * description
 *
 * @author RuiHaoZ on CMHK.jx
 * @date 2020-06-30 23:29
 */
@Service
public class ShortInfoServiceImpl extends ServiceImpl<ShortInfoMapper, ShortInfo> implements ShortInfoService {
    @Override
    public ShortInfo find(ShortEnum shortEnum, String longId) {
        QueryWrapper<ShortInfo> wrapper = new QueryWrapper<>();
        if (shortEnum != null) {
            wrapper.eq("SHORT_TYPE", shortEnum.getCode());
        }
        wrapper.eq("LONG_ID", longId);
        return this.getOne(wrapper);
    }
}

